package com.bsuir.avareader.dal;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.provider.BaseColumns;

public class AvaReaderDbHelper extends SQLiteOpenHelper implements BaseColumns {

	private static final int DB_VERSION = 1;
	private static final String DB_NAME = "AvaReader";
	
	// Abookmarks table
  // ann.goman
	public static final String TABLE_BOOKMARKS = "Abookmarks"; 
	public static final String NAME = "name";
	public static final String RATIO = "ratio";

	
	// Textbook table
	public static final String TABLE_TEXTBOOK = "Textbook";
	public static final String KEY_ID = "_id";
	public static final String INDEX = "lineIndex";
	public static final String LINE = "line";
	
	private static final String CREATE_TABLE = "create table " + TABLE_BOOKMARKS
			+ " ( _id integer primary key autoincrement, " + RATIO + " REAL, "  + NAME + " TEXT);";
	private static final String CREATE_TEXTBOOK_TABLE = "create table " + TABLE_TEXTBOOK + 
			" ( " + KEY_ID + " integer primary key autoincrement, " + INDEX + " INTEGER, " + LINE + " TEXT);";

	public AvaReaderDbHelper(Context context){
		super(context, DB_NAME, null, DB_VERSION);

	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(CREATE_TABLE);
		db.execSQL(CREATE_TEXTBOOK_TABLE);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

	}

}
